<?php
/**
 * @Created by PhpStorm.
 * @User: jameswong
 * @Date: 1/5/17
 * @Time: 10:05 AM
 * @Copyright : Fiidee.Monda.Cn
 */

namespace api\service;

use api\service\interfaces\IAreaService;
use herosphp\bean\Beans;
use herosphp\utils\AjaxResult;
use herosphp\core\Loader;

Loader::import('api.service.interfaces.IAreaService');

class AreaService implements IAreaService{

    /**
     * @param $ids
     * @return AjaxResult
     */
    public function getAreaByids($ids)
    {
        if(!$ids){
            return new AjaxResult(AjaxResult::OP_FAILURE,"error params",null);
        }
        $areaService = Beans::get('system.area.service');
        $item = $areaService->getItems(array('id'=>array('$in'=>$ids)),'name',null,null,null,null);
        $address = "";
        foreach ($item as $value){
            $address .= $value['name'];
        }
        $resVo = new AjaxResult(AjaxResult::OP_SUCCESS,"success",null);
        $resVo->putItem($address);
        return $resVo;
    }
}